<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%--<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>--%>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>挂靠公司详细信息</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div id="pageInTab" class="pageInTab">
        <div tabid="tabA" title="基本信息" id="tabAId">
            <form id="prj_lnk_comp_form" name="prj_lnk_comp_form">
                <div class="fieldset1 tabel_col clearFix">
                    <div class="fieldBox col_50">
                        <div class="label">公司名称</div>
                        <div class="field">
                            <input name="lnkCompNm" id="lnkCompNm" type="text"
                                   class="ui-textbox" value="${prjLnkComp.lnkCompNm }"
                                   validate="{required:true}"> <span
                                class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">统一社会信用代码</div>
                        <div class="field">
                            <input name="succ" id="succ" type="text"
                                   class="ui-textbox" value="${prjLnkComp.succ}"
                                   validate="{required:true}"> <span
                                class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">公司归属</div>
                        <div class="field">
                            <select name="ownerCd" id="ownerCd" validate="{required:true}">
                                <c:forEach items="${keyValueList}" var="opt">
                                    <option value="${opt.key}"
                                            <c:if test="${opt.key==prjLnkComp.ownerCd }">selected="selected"</c:if>>${opt.value}</option>
                                </c:forEach>
                            </select> <span class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">所在地</div>
                        <div class="field">
                            <input name="officeAddr" id="officeAddr" type="text"
                                   isShow="iscar" class="ui-textbox"
                                   value="${prjLnkComp.officeAddr }" validate="{required:true}"> <span
                                class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">主营项目类别</div>
                        <div class="field">
                            <input name="majorBiz" id="majorBiz" type="text"
                                   class="ui-textbox" value="${prjLnkComp.majorBiz }" validate="{required:true}"><span
                                class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">企业类型</div>
                        <div class="field">
                            <input name="compTyp" id="compTyp" type="text"
                                   class="ui-textbox" value="${prjLnkComp.compTyp }">
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">注册地址</div>
                        <div class="field">
                            <input name="regAddr" id="regAddr" type="text"
                                   class="ui-textbox" value="${prjLnkComp.regAddr }" validate="{required:true}">
                                   <span
                                class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">成立日期</div>
                        <div class="field">
                            <input name="regDt" id="regDt" type="text" isShow="iscar"
                                   class="ui-datepicker" value="${prjLnkComp.regDtStr }" validate="{required:true}"> <span
                                class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">道路运输许可证有效期</div>
                        <div class="field">
                            <input name="expDt" id="expDt" type="text" isShow="isother"
                                   class="ui-datepicker" value="${prjLnkComp.expDtStr }"
                                   > 
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">经营范围</div>
                        <div class="field">
                            <input name="bizScope" id="bizScope" type="text"
                                   class="ui-textbox" value="${prjLnkComp.bizScope }" validate="{required:true}">
                                   <span
                                class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50" rlPsnDiv="zk">
                        <div class="label">法人代表</div>
                        <div class="field">
                            <input name="corpRep" id="corpRep" type="text" isShow="iscar"
                                   class="ui-textbox" value="${prjLnkComp.corpRep }"> <span
                                class="requiredSymbol" isShow="iscar">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50" rlPsnDiv="zk">
                        <div class="label">法人身份证号</div>
                        <div class="field">
                            <input name="idNo" id="idNo" type="text" class="ui-textbox"
                                   value="${prjLnkComp.idNo }">
                        </div>
                    </div>

                    <div class="fieldBox col_50">
                        <div class="label">现累计挂靠数量</div>
                        <div class="field">
                            <input name="totLnkQty" id="totLnkQty" type="text"
                                   class="ui-textbox" value="${prjLnkComp.totLnkQty }">
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">自有车辆备案数量</div>
                        <div class="field">
                            <input name="ownQty" id="ownQty" type="text" class="ui-textbox"
                                   value="${prjLnkComp.ownQty }">
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">在我司累积挂靠车辆</div>
                        <div class="field">
                            <input name="ourTotLnkQyt" id="ourTotLnkQyt" type="text"
                                   class="ui-textbox" value="${prjLnkComp.ourTotLnkQyt }">
                        </div>
                    </div>
                    <div class="fieldBox col_33">
                        <div class="label">可支持挂靠项目类型</div>
                        <div class="field">
                            <span id="suppLnkPrjTypCd" name="suppLnkPrjTypCd">&nbsp;${prjLnkComp.suppPrjTypCdNm}</span>
                        </div>
                    </div>
                    <div class="fieldBox col_66_auto">
                        <div class="label">区域</div>
                        <div class="field">
                            <jsp:include page="../../system/sysRegion/region.jsp"
                                         flush="true">
                                <jsp:param name="regionShowLvl" value="2"/>
                            </jsp:include>
                            <span class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50" rlPsnDiv="zk">
                        <div class="label">实际控制人</div>
                        <div class="field">
                            <input name="actCtrlNm" id="actCtrlNm" type="text"
                                   class="ui-textbox" value="${prjLnkComp.actCtrlNm}"
                                   validate="{required:true}"> <span
                                class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50" rlPsnDiv="zk">
                        <div class="label">实际控制人手机号码</div>
                        <div class="field">
                            <input name="actCtrlMp" id="actCtrlMp" type="text"
                                   class="ui-textbox" value="${prjLnkComp.actCtrlMp }"
                                   validate="{required:true}"> <span
                                class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50" rlPsnDiv="zk">
                        <div class="label">联系人</div>
                        <div class="field">
                            <input name="lnkNm" id="lnkNm" type="text" class="ui-textbox"
                                   value="${prjLnkComp.lnkNm }">
                        </div>
                    </div>
                    <div class="fieldBox col_50" rlPsnDiv="zk">
                        <div class="label">联系人手机号码</div>
                        <div class="field">
                            <input name="lnkMp" id="lnkMp" type="text" isShow="iscar"
                                   class="ui-textbox" value="${prjLnkComp.lnkMp }"> <span
                                class="requiredSymbol" isShow="iscar">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_50" rlPsnDiv="zk">
                        <div class="label">联系人职务</div>
                        <div class="field">
                            <input name="lnkPost" id="lnkPost" type="text"
                                   class="ui-textbox" value="${prjLnkComp.lnkPost }">
                        </div>
                    </div>
                    <div class="fieldBox col_100">
                        <div class="label">备注</div>
                        <div class="field">
								<textarea name="rem" id="rem" rows="4"
                                          class="ui-textarea l-textarea" style="width: 80%"
                                          value="">${prjLnkComp.rem } </textarea>
                        </div>
                    </div>
                    <div class="fieldBox col_50" id="propCdDiv">
                        <div class="label">渠道担保业务类型</div>
                        <div class="field">
                            <input name="propCd" id="propCd" type="text" ltype="combobox">
                        </div>
                    </div>
                    <div class="fieldBox col_100_auto" id = "validDiv">
                        <div class="label">渠道担保协议有效期</div>
                        <div class="field">
                            <input width="20px" name="validTmStar" id="validTmStar" value="${prjLnkComp.validTmStar}" type="text" class="ui-datepicker" >
                            -
                            <input width="20px" name="validTmEnd" id="validTmEnd" value="${prjLnkComp.validTmEnd}" type="text" class="ui-datepicker" >
                            <span class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_66" id="roadDiv">
                        <div class="label">公路车【首期】比例</div>
                        <div class="field" style="width: 100%;">
                            <input name="roadBicycleRate" id="roadBicycleRate"  value="${prjLnkComp.roadBicycleRate}" type="text" class="ui-textbox" validate="{number:true}" ><span>%</span>
                            <span class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldBox col_66" id="stopDiv">
                        <div class="label">工程车【首期】比例</div>
                        <div class="field" style="width: 100%;">
                            <input name="stopTruckRate" id="stopTruckRate" type="text" value="${prjLnkComp.stopTruckRate}" class="ui-textbox" validate="{number:true}"><span>%</span>
                            <span class="requiredSymbol">*</span>
                        </div>
                    </div>
                    <div class="fieldset1 tabel_col tabel_col_s clearFix" id="propFileDiv">
                        <div class="sqPanel_body">
                            <div id="propFileCfgGrid" class="sq-grid"></div>
                        </div>
                    </div>
                </div>
                <div class="fieldBox col_100" style="display: none;">
                    <div class="field">
                        <input name="lnkCompId" id="lnkCompId" type="text"
                               class="ui-textbox" value="${prjLnkComp.id }">
                    </div>
                </div>
                <div class="fieldset1 tabel_col clearFix">
                    <div class="caption">
                        <span class="title">项目发起人信息</span>
                    </div>
                    <div class="fieldset1 tabel_col clearFix">
                        <div class="fieldBox col_33">
                            <div class="label">客户经理</div>
                            <div class="field">
                                <span id="startPrjCstMgrNm" name="startPrjCstMgrNm">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">联系方式</div>
                            <div class="field">
                                <span id="startPrjCstMgrTel" name="startPrjCstMgrTel">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">所属机构</div>
                            <div class="field">
                                <span id="startPrjCstMgrOrgCdNm" name="startPrjCstMgrOrgCdNm">&nbsp;</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="fieldBox col_100" id="psnDiv" style="display: none">
                    <div class="sqPanel">
                        <div class="sqPanel_head inL">
                            <div class="btnsBox inLC">
									<span id="addBtn" onclick="addBtn();"
                                          class="sq-button sq-button-round">添加</span>
                            </div>

                            <span>主要人员信息</span>

                            <div class="fieldBox col_100" style="display: none;">
                                <div class="field">
                                    <input name="prelist" id="preList" type="text"
                                           class="ui-textbox" value="${rlPsnList}">
                                </div>
                            </div>
                        </div>
                        <br/> <br/>
                        <div id="psnGrid">
                            <div id="ligergrid_psn" class="sq-grid"></div>
                        </div>
                    </div>
                </div>
                <div class="fieldset1 tabel_col tabel_col_s clearFix">
                    <div class="caption">
                        <span class="title">上传附件信息</span>
                    </div>
                    <div class="sqPanel_body">
                        <div id="lnkFileInfoCfgGrid" class="sq-grid"></div>
                    </div>
                </div>
                <div class="btnsBox">

                </div>
            </form>
        </div>
        <div tabid="tabB" title="相关项目" id="tabBId">
            <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
        </div>
        <div tabid="tabC" title="备案账号" id="tabCId">
            <iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
        </div>
        <div tabid="tabF" title="变更记录">
            <iframe src="" frameborder="0" name="tabF" id="tabF"></iframe>
        </div>
        <div tabid="tabD" title="敞口历史" id="tabDId">
            <iframe frameborder="0" name="tabD" id="tabD" src=""></iframe>
        </div>
        <div tabid="tabE" title="人工干预" id="tabEId">
            <iframe frameborder="0" name="tabE" id="tabE" src=""></iframe>
        </div>
        <div tabid="tabG" title="附件资料">
            <iframe src="" frameborder="0" name="tabG" id="tabG"></iframe>
        </div>
        
    </div>
</div>
</div>

<script type="text/javascript">

    var BuOrgCd = '${BuOrgCd}';
    var audStsCd = '${audStsCd}';
    var applyId = '${applyId}';
    var rlPsnGrid;
    var rlPsnList = null;
    var isFlow = '${isFlow}';
    if ('${rlPsnList}') {
        rlPsnList =${rlPsnList};
    }
    var certTypCdList =${certTypCdList};
    var rlRsnTypListJSON =${rlRsnTypListJSON};
    var rlRsnTypList = [];
    if ('${rlRsnTypList}') {
        rlRsnTypList = JSON.parse('${rlRsnTypList}');
    }

    //默认必填项
    var mustAddRlPsnJSON = [];
    if ('${mustAddRlPsnTypCdJSON}') {
        mustAddRlPsnJSON = JSON.parse('${mustAddRlPsnTypCdJSON}');
    }
    //默认非必填项
    var noAddRlPsnJSON = [];
    if ('${noAddRlPsnTypCdJSON}') {
        noAddRlPsnJSON = ${noAddRlPsnTypCdJSON};
    }

    var lnkFileInfoCfgGrid = null;//挂靠公司资料配置明细
    var propFileCfgGrid = null ;

    var isCheckVerify = '${isCheckVerify}';

    var _cfgSysCd ; //附件系统CODE
    var _cfgOrgCd ; //附件组织架构
    var _tabNm ; //附件对应表
    var _cfgCd ; //附件CODE
    var _modulePath ;
    var _costomerPath ;
    var _rootPath ;
    var _uploadSysCd ;
    if ('${prjLnkComp.ownerCd}' == '3') {
        _cfgSysCd = '${cfgSysCd3}';
        _cfgOrgCd = '${cfgOrgCd3}';
        _tabNm = '${tabNm3}';
        _cfgCd = '${cfgCd3}';
        _modulePath = '${modulePath3}';
        _costomerPath = '${costomerPath3}';
        _rootPath = '${rootPath3}';
        _uploadSysCd = '${uploadSysCd3}';
    } else if ('${prjLnkComp.ownerCd}' == '1') {
        _cfgSysCd = '${cfgSysCd1}';
        _cfgOrgCd = '${cfgOrgCd1}';
        _tabNm = '${tabNm1}';
        _cfgCd = '${cfgCd1}';
        _modulePath = '${modulePath1}';
        _costomerPath = '${costomerPath1}';
        _rootPath = '${rootPath1}';
        _uploadSysCd = '${uploadSysCd1}';
    } else {
        _cfgSysCd = '${cfgSysCd2}';
        _cfgOrgCd = '${cfgOrgCd2}';
        _tabNm = '${tabNm2}';
        _cfgCd = '${cfgCd2}';
        _modulePath = '${modulePath2}';
        _costomerPath = '${costomerPath2}';
        _rootPath = '${rootPath2}';
        _uploadSysCd = '${uploadSysCd2}';
    }
    var _propCfgSysCd = '${propCfgSysCd}'; //附件系统CODE
    var _propCfgOrgCd = '${propCfgOrgCd}'; //附件组织架构
    var _propTabNm = '${propTabNm}'; //附件对应表
    var _propCfgCd = '${propCfgCd}'; //附件CODE
    var _propModulePath = '${propModulePath}';
    var _propCostomerPath = '${propCostomerPath}';
    var _propRootPath = '${propRootPath}';
    var _propUploadSysCd = '${propUploadSysCd}';
    var _isShowRate = '${isShowRate}';

    var allCfgDtlCdList = [];
    if ('${allCfgDtlCdList}') {
        allCfgDtlCdList = JSON.parse('${allCfgDtlCdList}');
    }

    var pageInApp = {
        flag: true
    };
    $(function () {
        initStyle();

        initData();

        var lnkCompId = $("#lnkCompId").val();
        /*if (BuOrgCd == "00000005") {
            initRlPsnCarGrid();
        } else {
            initRlPsnGrid();
        }*/
        if(2 == $( "#ownerCd").val()){
            $("#propCdDiv").show();
            $("#validDiv").show();
            if(_isShowRate && _isShowRate == 1) {
                $("#stopDiv").show();
                $("#roadDiv").show();
            }else{
                $("#stopDiv").hide();
                $("#roadDiv").hide();
            }
            $("#propFileDiv").show();
        }else{
            $("#propCdDiv").hide();
            $("#validDiv").hide();
            $("#stopDiv").hide();
            $("#roadDiv").hide();
            $("#propFileDiv").hide();
        }
        var _propCdListJson = ${propCdListJson};
        $("#propCd").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
            data: _propCdListJson,
            valueField: 'key',
            textField:'value'
        });
        initRlPsnGrid();
        //禁用表单所有数据
        disableFiled();

        lnkFileInfoCfgGrid = $("#lnkFileInfoCfgGrid").ligerGrid({
            url: '<%=path%>/project/prjlnkcomp/initLnkFileInfoList.do?pkId='+lnkCompId+'&cfgCd='+_cfgCd +'&tabNm='+_tabNm +"&cfgSysCd="+_cfgSysCd+'&cfgOrgCd='+_cfgOrgCd+'&uploadSysCd='+_uploadSysCd+'&applyId='+applyId,
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function (rowdata, rowindex, value) {
                        var mustSymbol = '<span class="requiredSymbol">*</span>';
                        if (rowdata.isMust == 1) {
                            return value + mustSymbol;
                        } else {
                            return value;
                        }
                    }
                },
                {display: '上传文件名称', name: 'fileNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传文件路径', name: 'filePath',align: 'left', minWidth: 100,hide:true},
                {display: '上传文件明细', name: 'cfgDtlCd',align: 'left', minWidth: 100,hide:true},
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
                {display: '操作', name: '', minWidth: 200,align: 'left',  enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.audStsCd){
                            if(rowdata.audStsCd !=1){
                                if(!isCheckVerify || isCheckVerify != 1 ){
                                    /*if(rowdata.fileId) {
                                        h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile(event,' + rowdata.fileId + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                    }else{
                                        h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex +','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                                    }*/
                                }else{
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }else{
                                if (isCheckVerify && isCheckVerify == 1) {
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }
                        }else{
                            //h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex + ','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                        }
                        return h;
                    }
                },
                {display: '上传', name: 'uploadNm', width: 80,align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        /*if(audStsCd && audStsCd != 1){
                            if(rowdata.fileId){
                                if(rowdata.audStsCd && rowdata.audStsCd !=1){
                                    h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                        ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',\''+rowdata.fileId+'\',\''+rowindex+'\')"></span>';
                                }else if(!rowdata.audStsCd){
                                    h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                        ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',\''+rowdata.fileId+'\',\''+rowindex+'\')"></span>';
                                }
                            }else{
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',\''+rowdata.fileId+'\',\''+rowindex+'\')"></span>';
                            }
                        }*/
                        return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function ()
            {
                $('#lnkFileInfoCfgGrid').rowspan('datNm');
                $('#lnkFileInfoCfgGrid').rowspan('uploadNm');
            },
            onSuccess : function(data,grid){
                //初始化必传标识
                var rows = data.rows;
                for (var i = 0; i < rows.length; i++) {
                    for (var j = 0; j < allCfgDtlCdList.length; j++) {
                        if (allCfgDtlCdList[j].cfgCd == _cfgCd) {
                            if (allCfgDtlCdList[j].cfgDtlCd == rows[i].cfgDtlCd) {
                                var currentRow = rows[i];
                                currentRow.isMust = allCfgDtlCdList[j].isMust;
                                lnkFileInfoCfgGrid.updateRow(rows[i], currentRow);
                                //lnkFileInfoCfgGrid.reRender();
                            }
                        }
                    }
                }
            },
        });
        propFileCfgGrid = $("#propFileCfgGrid").ligerGrid({
            url: '<%=path%>/project/prjlnkcomp/initPropFileList.do?cfgCd='+_propCfgCd +'&tabNm='+_propTabNm +"&cfgSysCd="+_propCfgSysCd+'&cfgOrgCd='+_propCfgOrgCd+'&uploadSysCd='+_propUploadSysCd,
            parms:{pkId:lnkCompId},
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function (rowdata, rowindex, value) {
                        var mustSymbol = '<span class="requiredSymbol">*</span>';
                        if (rowdata.isMust == 1) {
                            return value + mustSymbol;
                        } else {
                            return value;
                        }
                    }
                },
                {display: '上传文件名称', name: 'fileNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传文件路径', name: 'filePath',align: 'left', minWidth: 100,hide:true},
                {display: '上传文件明细', name: 'cfgDtlCd',align: 'left', minWidth: 100,hide:true},
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
                {display: '操作', name: '', minWidth: 200,align: 'left',  enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.audStsCd){
                            if(rowdata.audStsCd !=1){
                                if(!isCheckVerify || isCheckVerify != 1 ){
                                    /*if(rowdata.fileId) {
                                        h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile(event,' + rowdata.fileId + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                    }else{
                                        h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex +','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                                    }*/
                                }else{
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }else{
                                if (isCheckVerify && isCheckVerify == 1) {
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }
                        }else{
                            //h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex + ','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                        }
                        return h;
                    }
                },
                {display: '上传', name: 'uploadNm', width: 80,align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function ()
            {
                $('#propFileCfgGrid').rowspan('datNm');
                $('#propFileCfgGrid').rowspan('uploadNm');
            },
            onSuccess : function(data,grid){
                upload_result_params2 = [];
                var uploadJOSN = JSON.parse(JSON.stringify(data.rows));
                console.log("uploadJOSN =s= " + JSON.stringify(uploadJOSN));
                for (var i=0; i< uploadJOSN.length; i++){
                    if (StringUtils.isNotEmpty(uploadJOSN[i].fileNm)) {
                        upload_result_params2.push(uploadJOSN[i]);
                    }
                }
                console.log("upload_result_params2 =s= " + JSON.stringify(upload_result_params));

            },
        });


    });

    //修改资料的验证状态
    function modifyAudStsCd(event,_fileId,_audStsCd){
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {'fileId':_fileId,'audStsCd':_audStsCd},
            url: '<%=path%>/product/splInfo/modifyFileAudStsCd.do',
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    //$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    event.stopPropagation();
                    var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
                    liger.get(gridID).reload();
                }else{
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value && ''!= value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

    function uploadFileByUrl(_url,_name){
        if(SQ.regs.img.test(_name)){
            //SQ.imgPreview(_url);
            //SQ.imgPreview(_url, true);
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
            window.open(_url);
        }
    }

    function initStyle() {
        if (BuOrgCd == "00000005") {
            $("span[isShow='iscar']").each(function () {
                $("input[isShow='iscar']").each(function () {
                    $(this).attr("validate", "{required:true}");
                });
                $(this).show();
            });
            $("span[isShow='isother']").each(function () {
                $("input[isShow='isother']").each(function () {
                    $(this).attr("validate", "");
                });
                $(this).hide();
            });
            $("div[rlPsnDiv='zk'] div input").each(function () {
                $(this).attr("validate", "");
            });
            $("div[rlPsnDiv='zk']").each(function () {
                $(this).hide();
            });
        } else {
            $("span[isShow='iscar']").each(function () {
                $("input[isShow='iscar']").each(function () {
                    $(this).attr("validate", "");
                });
                $(this).hide();
            });
            $("span[isShow='isother']").each(function () {
                $("input[isShow='isother']").each(function () {
                    $(this).attr("validate", "{required:true}");
                });
                $(this).show();
            });
        }
        if (BuOrgCd != "00000005") {
            if (audStsCd == FlowConstant.FLOW_CHECK_STATE_PASS) {
                $("#prj_lnk_comp_form div div div input").each(function () {
                    $(this).attr("readonly", "readonly");
                });
                $("#fileDetail").hide();
            } else {
                $("div[rlPsnDiv='zk']").each(function () {
                    $(this).hide();
                });
            }
            $("div[rlPsnDiv='zk'] div input").each(function () {
                $(this).attr("validate", "");
            });
            var compId = $("#lnkCompId").val();
        }
        $("#psnDiv").show();


    }

    var pageInTab = null;
    var loadedTabs = []

    //初始化数据
    function initData() {

        var propCdStr = '${prjLnkComp.propCd}';
        if(propCdStr){
            $("#propCd").ligerGetComboBoxManager().selectValue(propCdStr);
            $("#propCd").ligerGetComboBoxManager().updateStyle();
        }
        setFormatDateValue();
        setFormatRgnValue();
        var prj_lnk_comp_form = $("#prj_lnk_comp_form").ligerForm({
            validate: true,
            onAfterSetFields: function () {
                this.CACHED_INIT_VALUES = getFormValues(this.id)
            }
        });
        prj_lnk_comp_form.setFieldValidate("rgnProvCd", {
            required: true,
            select: false
        });
        prj_lnk_comp_form.setFieldValidate("rgnCityCd", {
            required: true,
            select: false
        });
        var id = $("#lnkCompId").val();
        if (!id) {
            var baseForm1 = liger.get("prj_lnk_comp_form");
            baseForm1.setData({
                ownerCd: ProjectConstant.CODE_OWNER_CD
            });
            //设置公司归属默认为第三方
        }
        initTab();
        if (BuOrgCd != "00000005") {
            if (audStsCd == FlowConstant.FLOW_CHECK_STATE_PASS) {
                liger.get("regDt").setDisabled(true);
                liger.get("expDt").setDisabled(true);
                liger.get("ownerCd").setDisabled(true);
                $("#rem").setDisabled_ligerTextarea(true);
            }
            pageInTab.removeTabItem("tabC");
        } else {
            pageInTab.removeTabItem("tabD");
        }

        //项目发起人信息
        $("#startPrjCstMgrNm").html('${prjLnkComp.startPrjCstMgrNm}');
        $("#startPrjCstMgrTel").html('${prjLnkComp.startPrjCstMgrTel}');
        $("#startPrjCstMgrOrgCdNm").html('${prjLnkComp.startPrjCstMgrOrgNm}');

    }

    //初始化Tab
    function initTab() {
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: GET_minIframeHeight(),
            onBeforeSelectTabItem: function (tabid) {
                var lnkCompId = $("#lnkCompId").val();
                if (tabid != "tabA") {
                    if (lnkCompId == null || lnkCompId == '') {
                        top.$.ligerDialog.SQalert({content: LogUtils.LOG_LNK_COMP_SELECT_BEFORE, SQ_type: "warning"});
                        return false;
                    }
                }
            },
            onAfterSelectTabItem: function (tabid) {
                //   if (loadedTabs.indexOf(tabid)<0) {
                var lnkCompId = $("#lnkCompId").val();
                if (tabid != "tabA") {
                    if (lnkCompId == null || lnkCompId == '') {
                        top.$.ligerDialog.SQalert({content: LogUtils.LOG_LNK_COMP_SELECT_BEFORE, SQ_type: "warning"});
                        return false; //验证不通过，不执行以下代码
                    }
                }
                loadedTabs.push(tabid);
                switch (tabid) {
                    case "tabB":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjBscInfoListPage.do?lnkCompId=" + lnkCompId + "&&isLnkCompFlag=1");
                        break;
                    case "tabC":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjLnkCompBkAcc/toListPage.do?compId=" + lnkCompId);
                        break;
                    case "tabD":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjLnkCompCrLim/toListPage.do?compId=" + lnkCompId);
                        break;
                    case "tabE":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstManualRelation/toListPage.do?Id=" + lnkCompId + "&useType=3&cstType=2");
                        break;
                    case "tabG":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjlnkcomp/toOldFilesListPage.do?id=" + lnkCompId);
                        break;
                    case "tabF":
						var lnkCompId = $("#lnkCompId").val();
						pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjLnkCompApply/prjCompApplyProcessPage.do?linkId=" + lnkCompId + "&&isLnkCompFlag=0" + "&isLnkPrjViewFlag=1");
                        break;
                }
                //     };
                SetIframe_height();
            }
        });

        $.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
    };

    //设置日期值
    function setFormatDateValue() {
        var regDt = $("#regDt").val();
        var expDt = $("#expDt").val();
        if (expDt) {
            var expDate = DateUtils.formatDate(new Date(expDt), DateUtils.YYYY_MM_DD);
            $("#expDt").val(expDate);//道路运输许可证有效期
        }
        if (regDt) {
            var regDate = DateUtils.formatDate(new Date(regDt), DateUtils.YYYY_MM_DD);
            $("#regDt").val(regDate);//注册日期
        }

    }

    function setFormatRgnValue() {
        rgnPrCd = '${prjLnkComp.rgnPrCd}';
        rgnCyCd = '${prjLnkComp.rgnCyCd}';
        //alert(rgnPrCd)
        setRgnProvCdUpdataValue(rgnPrCd);
        setRgnCityCdUpdataValue(rgnCyCd);
        setRegionSelectDataChange();
    }

    //检查是否重名
    function checkPrjLnkCompNm() {
        alert('${applyId}');
        var flag = false;
        var lnkCompNm = $("#lnkCompNm").val();
        var url = '<%=path%>/project/prjlnkcomp/checkPrjLnkCompNm.do';
        var data = {};
        data.lnkCompNm = lnkCompNm;
        if (lnkCompNm) {
            $.ajax({
                type: 'get',
                dataType: 'json',
                data: data,
                url: url,
                success: function (msg) {
                    if (msg.success == 1) {
                        if (msg.data) {
                            top.$.ligerDialog.SQalert({content: "该挂靠公司已经存在", SQ_type: "error"});
                            flag = true;
                        }
                    }
                }
            });
        }
        return flag;
    }

    //取消
    function cancelBtn() {
        var TAB = top.mainApp.parentTab;
        var currentTabid = TAB.getSelectedTabItemID();
        top.tab.removeTabItem(currentTabid);
    }

    function save() {
        var ligerForm = liger.get("prj_lnk_comp_form");
        if (!ligerForm.valid()) {
            top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        var rlPsnData = rlPsnGrid.getData();
        var lnkCompNm = $("#lnkCompNm").val();
        var lnkCompId = $("#lnkCompId").val();
        if (lnkCompId) {
            var data = ligerForm.getData();
            data["regDt"] = $("#regDt").val();
            data["expDt"] = $("#expDt").val();
            //event.preventDefault();

            var fileParams = upload_result_params;//getUploadResultParams();//获取附件上传的信息
			var checkFilesResult = checkFiles(fileParams);
			if (checkFilesResult != 1) {
				top.$.ligerDialog.SQalert({content: checkFilesResult, SQ_type: "warning"});
				return false;
			}
            data["fileParams"] = JSON.stringify(fileParams);
            if(deleteFileIdS){
				var deleteFileIdStr = deleteFileIdS.toString();
            	data["removeFileIds"] =  deleteFileIdStr;
            }
            //  if(BuOrgCd!=ProjectConstant.CODE_BU_ORG_CD_CAR){
            var isValid = SQ.validGrid('ligergrid_psn');
            if (isValid == false) {
                UIUtils.alertError("请正确填写！");
                return false;
            }
            ;
            data["rlPsnList"] = JSON.stringify(rlPsnData);
            //  }
            var url = '<%=path%>/project/prjLnkCompApply/addPrjLnkComp.do?flag=' + 'flag';
            var lnkCompId = $("#lnkCompId").val();
            data["lnkCompId"] = lnkCompId;

            //区域信息
            data["rgnPrCd"] = getRgnProvCd();//获取省代码
            data["rgnCyCd"] = getRgnCityCd();//获取市代码

            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: url,
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        if (!isFlow) {
                            var TAB = top.mainApp.parentTab;
                            var currentTabid = TAB.getSelectedTabItemID();
                            var currFrameElement = top.$("#" + currentTabid).get(0);
                            rlPsnGrid.reload();
                            //lnkFileInfoCfgGrid.reload();

                            //var callback = currFrameElement.W2W.callback;
                            //callback();
                            //top.tab.removeTabItem(currentTabid);
                        }
                    } else {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        }
        <%--  else {
                    var url = '<%=path%>/project/prjlnkcomp/checkPrjLnkCompNm.do';
                    var data = {};
                    data.lnkCompNm = lnkCompNm;
                    $.ajax({
                        type: 'get',
                        dataType: 'json',
                        data: data,
                        url: url,
                        success: function (msg) {
                            if (msg.success == 1) {
                                if (msg.data) {
                                    top.$.ligerDialog.SQalert({content: "该挂靠公司已经存在", SQ_type: "error"});
                                    return false;
                                }
                            } else {
                                var data = ligerForm.getData();
                                data["regDt"] = $("#regDt").val();
                                data["expDt"] = $("#expDt").val();

                                var fileParams = getUploadResultParams();//获取附件上传的信息
                                data["fileParams"] = JSON.stringify(fileParams);
                                //   if(BuOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZK){
                                var isValid = SQ.validGrid('ligergrid_psn');
                                if (isValid == false) {
                                    UIUtils.alertError("请正确填写！");
                                    return false;
                                }
                                ;
                                data["rlPsnList"] = JSON.stringify(rlPsnData);
                                //  }
                                var url = '<%=path%>/project/prjlnkcomp/addPrjLnkComp.do';
                                var lnkCompId = $("#lnkCompId").val();
                                data["lnkCompId"] = lnkCompId;
                                var wait_dialog;
                                $.ajax({
                                    type: 'post',
                                    dataType: 'json',
                                    data: data,
                                    url: url,
                                    beforeSend: function () {
                                        wait_dialog = $.ligerDialog.SQalert({
                                            content: LogUtils.LOG_CMM_DATA_LOADING,
                                            SQ_type: "waitting"
                                        });
                                    },
                                    success: function (msg) {
                                        wait_dialog.close();
                                        if (msg.success == 1) {
                                            $("#lnkCompId").val(msg.data);
                                            top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                                            var TAB = top.mainApp.parentTab;
                                            var currentTabid = TAB.getSelectedTabItemID();
                                            var currFrameElement = top.$("#" + currentTabid).get(0);
                                            var callback = currFrameElement.W2W.callback;
                                            callback();
                                            top.tab.removeTabItem(currentTabid);

                                        } else {
                                            top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                                        }
                                    }
                                });
                            }
                        }
                    });

                } --%>
    }

    <%-- function save() {
    	var compareResult1 = compareGridData('ligergrid_psn', ['rlNm', 'rlTypCdNm', 'certNo', 'tel'], 4);
        var compareResult2 = compareFormValues('prj_lnk_comp_form', ['lnkCompNm', 'orgCode', 'bizLicNo', 'taxRegNo', 'expDt']);
        var compareResult = !compareResult1 || !compareResult2 ? false : true;
    	if(compareResult==true){
    		var ligerForm = liger.get("prj_lnk_comp_form");
            if (!ligerForm.valid()) {
                top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            var rlPsnData = rlPsnGrid.getData();
            var lnkCompNm = $("#lnkCompNm").val();
            var lnkCompId = $("#lnkCompId").val();
            if (lnkCompId) {
                var data = ligerForm.getData();
                data["regDt"] = $("#regDt").val();
                data["expDt"] = $("#expDt").val();
                //event.preventDefault();

                var fileParams = getUploadResultParams();//获取附件上传的信息
                data["fileParams"] = JSON.stringify(fileParams);
                //  if(BuOrgCd!=ProjectConstant.CODE_BU_ORG_CD_CAR){
                var isValid = SQ.validGrid('ligergrid_psn');
                if (isValid == false) {
                    UIUtils.alertError("请正确填写！");
                    return false;
                }
                ;
                data["rlPsnList"] = JSON.stringify(rlPsnData);
                //  }

               var url = '<%=path%>/project/prjlnkcomp/addPrjLnkComp.do';
                var lnkCompId = $("#lnkCompId").val();
                data["lnkCompId"] = lnkCompId;

                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: data,
                    url: url,
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                            if (!isFlow) {
                                var TAB = top.mainApp.parentTab;
                                var currentTabid = TAB.getSelectedTabItemID();
                                var currFrameElement = top.$("#" + currentTabid).get(0);
                                var callback = currFrameElement.W2W.callback;
                                callback();
                                top.tab.removeTabItem(currentTabid);
                            }
                        } else {
                            top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        }
                    }
                });
            } else {
                var url = '<%=path%>/project/prjlnkcomp/checkPrjLnkCompNm.do';
                var data = {};
                data.lnkCompNm = lnkCompNm;
                $.ajax({
                    type: 'get',
                    dataType: 'json',
                    data: data,
                    url: url,
                    success: function (msg) {
                        if (msg.success == 1) {
                            if (msg.data) {
                                top.$.ligerDialog.SQalert({content: "该挂靠公司已经存在", SQ_type: "error"});
                                return false;
                            }
                        } else {
                            var data = ligerForm.getData();
                            data["regDt"] = $("#regDt").val();
                            data["expDt"] = $("#expDt").val();

                            var fileParams = getUploadResultParams();//获取附件上传的信息
                            data["fileParams"] = JSON.stringify(fileParams);
                            //   if(BuOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZK){
                            var isValid = SQ.validGrid('ligergrid_psn');
                            if (isValid == false) {
                                UIUtils.alertError("请正确填写！");
                                return false;
                            }
                            ;
                            data["rlPsnList"] = JSON.stringify(rlPsnData);
                            //  }
                            var url = '<%=path%>/project/prjlnkcomp/addPrjLnkComp.do';
                            var lnkCompId = $("#lnkCompId").val();
                            data["lnkCompId"] = lnkCompId;
                            var wait_dialog;
                            $.ajax({
                                type: 'post',
                                dataType: 'json',
                                data: data,
                                url: url,
                                beforeSend: function () {
                                    wait_dialog = $.ligerDialog.SQalert({
                                        content: LogUtils.LOG_CMM_DATA_LOADING,
                                        SQ_type: "waitting"
                                    });
                                },
                                success: function (msg) {
                                    wait_dialog.close();
                                    if (msg.success == 1) {
                                        $("#lnkCompId").val(msg.data);
                                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                                        var TAB = top.mainApp.parentTab;
                                        var currentTabid = TAB.getSelectedTabItemID();
                                        var currFrameElement = top.$("#" + currentTabid).get(0);
                                        var callback = currFrameElement.W2W.callback;
                                        callback();
                                        top.tab.removeTabItem(currentTabid);

                                    } else {
                                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                                    }
                                }
                            });
                        }
                    }
                });
            }
    	}else{
            startSqlAdmissionFlow();
    	}
    } --%>

    //发起审核流程
    function startSqlAdmissionFlow() {
        var modelTyp = FlowConstant.FLOW_MODEL_TYP_LNK_CHG;//流程业务分类-供应商准入
        if (StringUtils.isEmpty(modelTyp)) {
            return;
        }
        var flowDialog = $.ligerDialog.SQopen({
            url: '<%=path%>/flow/flow/toForStartListPage.do?modelTyp=' + modelTyp,
            width: 700,
            height: 400,
            title: '请选择要发起的流程',
            buttons: [{
                text: "确定", type: 'ok', cls: 'l-dialog-btn-ok',
                onclick: function (item, Dialog) {
                    if (Dialog.onOk) {
                        $.ligerDialog.SQconfirm('是否确定发起变更流程?', function (flag) {
                            if (flag == false) {
                                return;
                            } else {
                                Dialog.onOk();
                            }
                        })
                    }
                }
            }, {
                text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
                onclick: function (item, Dialog) {
                    if (Dialog.onCancel) Dialog.onCancel();
                }
            }
            ],
            onClose: function () {
                var json = flowDialog._DATA;
                if (!json) {
                    return;
                }
                saveApplyInfo(json);
            }
        });
    }

    function initRlPsnGrid() {
        var _compId = ${lnkCompId};
        var _applyId =
        ${applyId}
        var _audStsCd = 1
        rlPsnGrid = $("#ligergrid_psn").ligerGrid({
            usePager: false,
            url: '<%=path%>/project/prjLnkCompApply/initRlPsnList.do?compId=' + _compId + '&compApplyId=' + _applyId,
            method: 'get',
            columns: [
                {
                    display: '姓名(<span class="c_red">*</span>)', name: 'rlNm', minWidth: 60, editor: {type: 'text'},
                    validate: function (value, rowData, col) {
                        //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
                        if (StringUtils.isEmpty(value)) return "此项为必填项！";
                    }
                },
                {
                    display: '联系人类型(<span class="c_red">*</span>)', name: 'rlTypCdNm', minWidth: 60,
                    editor: {
                        type: 'select',
                        data: rlRsnTypListJSON,
                        valueField: 'key',
                        textField: 'value'
                    },
                    valueField: 'rlTypCd',
                    textField: 'rlTypCdNm',
                    render: function (item) {
                        return item.rlTypCdNm;
                    },
                    validate: function (value, rowData, col) {
                        //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
                        if (StringUtils.isEmpty(value)) return "此项为必填项！";
                    }
                },
                {display: '股比',name:'stockRatio',width:100},
                {
                    display: '证件类型', name: 'certTypCdNm', minWidth: 60,
                    editor: {
                        type: 'select',
                        data: certTypCdList,
                        valueField: 'key',
                        textField: 'value'
                    },
                    valueField: 'certTypCd',
                    textField: 'certTypCdNm',
                    render: function (item) {
                        return item.certTypCdNm;
                    },
                    validate: function (value, rowData, col) {
                        //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
                        if (StringUtils.isEmpty(value)) return "此项为必填项！";
                    }
                },
                {
                    display: '证件号码',
                    name: 'certNo',
                    width: 140,
                    //align: 'left',
                    editor: {type: 'text'},
                    render: function (value,rowData) {
                        if(StringUtils.isEmpty(value.certNo) && StringUtils.isNotEmpty(value.rlTypCd)){
                            if(noAddRlPsnJSON.indexOf(value.rlTypCd) >= 0){
                                return '<span class="c_gray">(非必填信息)</span>';
                            }else{
                                return '<span class="c_gray">(必填信息)</span>';
                            }
                        }
                        return value.certNo;
                    },
                    validate: function (value, rowData, col) {
                        //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
                        if (StringUtils.isEmpty(value)){
                            if((CollectionUtils.isEmpty(noAddRlPsnJSON)) || (CollectionUtils.isNotEmpty(noAddRlPsnJSON) && noAddRlPsnJSON.indexOf(rowData.rlTypCd) < 0)){
                                return "此项为必填项！";
                            }
                        }
                    }
                },
                {
                    display: '联系电话',
                    name: 'tel',
                    width: 100,
                    //align: 'left',
                    editor: {type: 'text'},
                    render: function (value,rowData) {
                        if(StringUtils.isEmpty(value.tel) && StringUtils.isNotEmpty(value.rlTypCd)){
                            if(noAddRlPsnJSON.indexOf(value.rlTypCd) >= 0){
                                return '<span class="c_gray">(非必填信息)</span>';
                            }else{
                                return '<span class="c_gray">(必填信息)</span>';
                            }
                        }
                        return value.tel;
                    },
                    validate: function (value, rowData, col) {
                        //if (StringUtils.isEmpty(value) && CollectionUtils.isNotEmpty(mustAddRlPsnJSON) && mustAddRlPsnJSON.indexOf(rowData.rlTypCd) >= 0) return "此项为必填项！";
                        if (StringUtils.isEmpty(value)){
                            if((CollectionUtils.isEmpty(noAddRlPsnJSON)) || (CollectionUtils.isNotEmpty(noAddRlPsnJSON) && noAddRlPsnJSON.indexOf(rowData.rlTypCd) < 0)){
                                return "此项为必填项！";
                            }
                        }
                    }
                },
                {display: '备注', name: 'rlRem', minWidth: 140, editor: {type: 'text'}},
                /* {
                    display: '工商信息校验', name: 'checkVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.busInfoVerify == 2 || rowdata.busInfoVerify == null && rowdata.id != null) {
                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(1,' + rowdata.id + ',' + rowdata.applyRlPsnId + ',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                        }
                        return h;
                    }
                }, */
                {
                    display: '工商信息校验结果', name: 'busInfoVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.busInfoVerify == 1) {
                            return "一致";
                        } else if (rowdata.busInfoVerify == -1) {
                            return "不一致";
                        } else if (rowdata.busInfoVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                /* {
                    display: '三要素校验（机构1）', name: 'PYCheck', minWidth: 150,
                    render: function (rowdata, rowindex, value) {

                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.pyPerVerify == 2 || rowdata.pyPerVerify == null && rowdata.id != null) {
                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(2,' + rowdata.id + ',' + rowdata.applyRlPsnId + ',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                        }
                        return h;
                    }
                }, */
                {
                    display: '三要素校验结果1', name: 'pyPerVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.pyPerVerify == 1) {
                            return "一致";
                        } else if (rowdata.pyPerVerify == -1) {
                            return "不一致";
                        } else if (rowdata.pyPerVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                /* {
                    display: '三要素校验（机构2）', name: 'TDCheck', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.tdPerVerify == 2 || rowdata.tdPerVerify == null && rowdata.id != null) {
                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(3,' + rowdata.id + ',' + rowdata.applyRlPsnId + ',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                        }
                        return h;
                    }
                }, */
                {
                    display: '三要素校验结果2', name: 'tdPerVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.tdPerVerify == 1) {
                            return "一致";
                        } else if (rowdata.tdPerVerify == -1) {
                            return "不一致";
                        } else if (rowdata.tdPerVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                /* {
                    display: '三要素校验（机构3）', name: 'BRCheck', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.brPerVerify == 2 || rowdata.brPerVerify == null && rowdata.id != null) {
                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(4,' + rowdata.id + ',' + rowdata.applyRlPsnId + ',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<input class="sq-button sq-button-round disabled" type="button" value="已校验" disabled>'
                            }
                        }
                        return h;
                    }
                }, */
                {
                    display: '三要素校验结果3', name: 'brPerVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.brPerVerify == 1) {
                            return "一致";
                        } else if (rowdata.brPerVerify == -1) {
                            return "不一致";
                        } else if (rowdata.brPerVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                // getOptColumn()
            ],
            onBeforeSubmitEdit: function (e) {//重新赋值,要不然选中后离开会把key显示在前端
                if (e.selected && e.column.columnname == "certTypCdNm") {
                    e.record.certTypCdId = e.value;
                    e.value = e.selected[e.column.editor.textField];
                    e.record.certTypCd = e.record.certTypCdId;
                }
                if (e.selected && e.column.columnname == "rlTypCdNm") {
                    e.record.rlTypCdId = e.value;
                    e.value = e.selected[e.column.editor.textField];
                    e.record.rlTypCd = e.record.rlTypCdId;
                }
            },
            onBeforeEdit: function (e) {
                var strIsDefault = e.record.isDefault;
                var colName = e.column.columnname;
                e.column.editor.readonly = true;
                /*  if (StringUtils.isNotEmpty(strIsDefault) && strIsDefault == 1) {
                     if (colName == 'rlTypCdNm' || colName == 'certTypCdNm'|| colName == 'rlNm'
                    	 || colName == 'certNo'|| colName == 'tel') {
                         e.column.editor.readonly = true;
                     } else {
                         e.column.editor.readonly = false;
                     }
                 } else {
                     e.column.editor.readonly = false;
                 } */
            },
            pageSize: 100,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            heightDiff: -2,
            checkbox: false,
            enabledEdit: true,
            allowUnSelectRow: true,
            alternatingRow: false,
            rownumbers: true,
            enabledSort: false,
            usePagerOnLessPagesize: false,
            onAfterShowData: function (currentData) {
                this.CACHED_DATA = JSON.parse(JSON.stringify(currentData))
            }
        });
        rlPsnGrid.setHeight(200);
    }

    function initRlPsnCarGrid() {
        var _compId = ${lnkCompId};
        var _applyId =
        ${applyId}
        var _audStsCd = 1
        rlPsnGrid = $("#ligergrid_psn").ligerGrid({
            usePager: false,
            url: '<%=path%>/project/prjLnkCompApply/initRlPsnList.do?compId=' + _compId + '&compApplyId=' + _applyId,
            method: 'get',
            columns: [
                {display: '姓名(<span class="c_red">*</span>)', name: 'rlNm', minWidth: 60, editor: {type: 'text'}},
                {
                    display: '联系人类型(<span class="c_red">*</span>)', name: 'rlTypCdNm', minWidth: 60,
                    editor: {
                        type: 'select',
                        data: rlRsnTypListJSON,
                        valueField: 'key',
                        textField: 'value'
                    },
                    valueField: 'rlTypCd',
                    textField: 'rlTypCdNm',
                    render: function (item) {
                        return item.rlTypCdNm;
                    },
                    validate: function (value) {
                        if (value == '' || value == undefined) return "此项为必填项！";
                    }
                },
                {display: '股比',name:'stockRatio',width:100},
                {
                    display: '证件类型(<span class="c_red">*</span>)', name: 'certTypCdNm', minWidth: 60,
                    editor: {
                        type: 'select',
                        data: certTypCdList,
                        valueField: 'key',
                        textField: 'value'
                    },
                    valueField: 'certTypCd',
                    textField: 'certTypCdNm',
                    render: function (item) {
                        return item.certTypCdNm;
                    },
                    validate: function (value) {
                        if (value == '' || value == undefined) return "此项为必填项！";
                    }
                },
                {
                    display: '证件号码(<span class="c_red">*</span>)',
                    name: 'certNo',
                    width: 140,
                    align: 'left',
                    editor: {type: 'text'}
                },
                {
                    display: '联系电话(<span class="c_red">*</span>)',
                    name: 'tel',
                    width: 100,
                    align: 'left',
                    editor: {type: 'text'},
                    validate: function (value) {
                        if (value == '' || value == undefined) return "此项为必填项！";
                    }
                },
                {display: '备注', name: 'rlRem', minWidth: 140, editor: {type: 'text'}},
                {
                    display: '工商信息校验', name: 'checkVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.busInfoVerify == 2 || rowdata.busInfoVerify == null && rowdata.id != null) {
                                //h += "<a  href = "javascript:checkRlPsn('Verify',\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\');" class = "sq-button sq-button-round">验证</a>"

                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(1,\'' + rowdata.id + '\',' + rowdata.applyRlPsnId + ',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                            /* if(rowdata.busInfoVerify != 1){
                                h+= '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(1,\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\',\''+rowdata.rlTypCd+'\');">验证</a>'
                            }else{
                                h +='<div class="sq-button sq-button-round disabled">已校验</div>'
                            } */
                        }
                        return h;
                    }
                },
                {
                    display: '工商信息校验结果', name: 'busInfoVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.busInfoVerify == 1) {
                            return "一致";
                        } else if (rowdata.busInfoVerify == -1) {
                            return "不一致";
                        } else if (rowdata.busInfoVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                {
                    display: '三要素校验（机构1）', name: 'PYCheck', minWidth: 150,
                    render: function (rowdata, rowindex, value) {

                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.pyPerVerify == 2 || rowdata.pyPerVerify == null && rowdata.id != null) {
                                //h += "<a  href = "javascript:checkRlPsn('Verify',\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\');" class = "sq-button sq-button-round">验证</a>"

                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(2,\'' + rowdata.id + '\',' + rowdata.applyRlPsnId + ',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                            /* if(rowdata.pyPerVerify != 1){
                                h+= '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(2,\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\',\''+rowdata.rlTypCd+'\');">验证</a>'
                            }else{
                                h+='<div class="sq-button sq-button-round disabled">已校验</div>'
                            } */
                        }
                        return h;
                    }
                },
                {
                    display: '三要素校验结果1', name: 'pyPerVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.pyPerVerify == 1) {
                            return "一致";
                        } else if (rowdata.pyPerVerify == -1) {
                            return "不一致";
                        } else if (rowdata.pyPerVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                {
                    display: '三要素校验（机构2）', name: 'TDCheck', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.tdPerVerify == 2 || rowdata.tdPerVerify == null && rowdata.id != null) {
                                //h += "<a  href = "javascript:checkRlPsn('Verify',\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\');" class = "sq-button sq-button-round">验证</a>"

                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(3,\'' + rowdata.id + '\',' + rowdata.applyRlPsnId + ',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                            /* if(rowdata.tdPerVerify != 1){
                                h+= '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(3,\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\',\''+rowdata.rlTypCd+'\');">验证</a>'
                            }else{
                                h +='<div class="sq-button sq-button-round disabled">已校验</div>'
                            } */
                        }
                        return h;
                    }
                },
                {
                    display: '三要素校验结果2', name: 'tdPerVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.tdPerVerify == 1) {
                            return "一致";
                        } else if (rowdata.tdPerVerify == -1) {
                            return "不一致";
                        } else if (rowdata.tdPerVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                {
                    display: '三要素校验（机构3）', name: 'BRCheck', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.brPerVerify == 2 || rowdata.brPerVerify == null && rowdata.id != null) {
                                //h += "<a  href = "javascript:checkRlPsn('Verify',\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\');" class = "sq-button sq-button-round">验证</a>"
                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(4,\'' + rowdata.id + '\',' + rowdata.applyRlPsnId + ',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<input class="sq-button sq-button-round disabled" type="button" value="已校验" disabled>'
                            }
                            /* if(rowdata.brPerVerify != 1){
                                h+= '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(4,\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\',\''+rowdata.rlTypCd+'\');">验证</a>'
                            }else{
                                h +='<input class="sq-button sq-button-round disabled" type="button" value="已校验" disabled>'
                            } */

                        }
                        return h;
                    }
                },
                {
                    display: '三要素校验结果3', name: 'brPerVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.brPerVerify == 1) {
                            return "一致";
                        } else if (rowdata.brPerVerify == -1) {
                            return "不一致";
                        } else if (rowdata.brPerVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                //getOptColumn()
            ],
            onBeforeSubmitEdit: function (e) {//重新赋值,要不然选中后离开会把key显示在前端
                if (e.selected && e.column.columnname == "certTypCdNm") {
                    e.record.certTypCdId = e.value;
                    e.value = e.selected[e.column.editor.textField];
                    e.record.certTypCd = e.record.certTypCdId;
                }
                if (e.selected && e.column.columnname == "rlTypCdNm") {
                    e.record.rlTypCdId = e.value;
                    e.value = e.selected[e.column.editor.textField];
                    e.record.rlTypCd = e.record.rlTypCdId;
                }
            },


            onBeforeEdit: function (e) {
                e.lastValue = e.value;
                e.index = e.rowindex;
                e.column.editor.readonly = false;
                var colNanme = e.column.columnname;
                if (e.record.isSysDef == 1) {
                    if (colNanme == "rlTypCdNm") {
                        e.column.editor.readonly = true;
                    }
                }
            },
            pageSize: 100,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            heightDiff: -2,
            checkbox: false,
            enabledEdit: true,
            allowUnSelectRow: true,
            alternatingRow: false,
            rownumbers: true,
            enabledSort: false,
            usePagerOnLessPagesize: false,
        });
        rlPsnGrid.setHeight(200);
    }


    function relationshipsView() {
        var org_cd = $("#succ").val();
        var id = $("#sid").val();
        var currentUserId = '${currentUserId}';
        if (!org_cd) {
            $.ligerDialog.SQalert({content: "社会同一信用代码为空！", SQ_type: "warning"});
            return false;
        }
        Add_navTab('tab_relationships_view_data' + applyId + '1', '集团关联图谱', '<%=path%>/knowledgeGraph/init/initGraphGroupPage.do?org_code=' + org_cd+'&usrId='+currentUserId);
    }

    function checkRlPsn(type, dataId, applyPsnId, rlNm, certNo, tel, rlTypCd) {
        var _type;
        if (type == 1) {
            _type = 'verify';
        }
        if (type == 2) {
            _type = 'PY';
        }
        if (type == 3) {
            _type = 'TD';
        }
        if (type == 4) {
            _type = 'BR';
        }
        var _lnkCompId = $("#lnkCompId").val();
        var _url = '<%=path%>/project/prjLnkCompRlPsn/checkRlPsn.do';
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {
                type: _type,
                dataId: dataId,
                rlNm: rlNm,
                certNo: certNo,
                tel: tel,
                compId: _lnkCompId,
                applyPsnId: applyPsnId
            },
            url: _url,
            success: function (msg) {
                if (msg.success == 1) {
                    //alert(msg.info)
                    initRlPsnCarGrid();
                    initRlPsnGrid();
                } else {
                    // $.ligerDialog.SQalert({content:msg.data, SQ_type: "error"});
                    initRlPsnCarGrid();
                    initRlPsnGrid();
                }
            }
        });
    }

    //获取操作列
    function getOptColumn() {
        var column = {
            display: '操作',
            isSort: false,
            width: 150,
            align: 'left',
            render: function (rowdata, rowindex, value) {
                var h = "";
                if (rowdata.isDefault != 1) {
                    h += '<a class="sq-button-hasicon" href="javascript:removeBtn(';
                    h += "'" + rowdata.id + "'";
                    h += ')"><i class="sqBtnIco_7"></i>删除</a>'
                }
                return h;
            }
        }
        return column;
    }

    function removeBtn() {
        var selectedRows = rlPsnGrid.getSelectedRows();
        if (selectedRows.length != 1) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warring"});
            return;
        }
        $.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
            if (flag == false) return;
            if (selectedRows[0].id) {
                //删除数据
                var _ids = [];
                for (var index in selectedRows) {
                    _ids.push(selectedRows[index].id);
                }
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {ids: JSON.stringify(_ids)},
                    url: '<%=path%>/project/prjLnkCompRlPsn/removeByIds.do',
                    success: function (msg) {
                        if (msg.success == 1) {
                            rlPsnGrid.deleteSelectedRow();
                            UIUtils.alertSuccess(msg.info);
                        } else {
                            UIUtils.alertError(msg.info);
                        }
                    }
                });

            } else {
                rlPsnGrid.deleteSelectedRow();
            }
        });
    }

    function addBtn() {
        //添加联系人信息
        var manager = $("#ligergrid_psn").ligerGetGridManager();
        manager.addRow({
            rlNm: '',
            rlTypCd: '',
            certTypCd: '0',
            certTypCdNm: '身份证',
            certNo: '',
            tel: '',
            rlRem: '',
        });
    }


    //对比ligerGrid编辑前后的Data
    //@param gridID <字符串> - ligerGrid id
    //@param fields [数组<字符串>] - 要对比的列的字段
    //@param count <数字>可选 - 参与对比的前几行
    //返回值：<Boolean> 如果对比结果一样，返回true，否者返回false
    //注：grid 加载完(onAfterShowData)后 必须缓存数据到'CACHED_DATA'这个属性上 ！！！
    function compareGridData(gridID, fields, count) {
        var grid = liger.get(gridID),
            cachedData = count ? grid.CACHED_DATA[grid.options.root].slice(0, count) : grid.CACHED_DATA[grid.options.root],
            currentData = count ? grid.getData().slice(0, count) : grid.getData(),
            cachedData_f = _filterData(cachedData),
            currentData_f = _filterData(currentData);
        return JSON.stringify(cachedData_f) === JSON.stringify(currentData_f)

        function _filterData(dataArr) {
            var newData = [];
            $(dataArr).each(function (index, rowData) {
                var newRow = {};
                for (var i = 0; i < fields.length; i++) {
                    var key = fields[i];
                    newRow[key] = rowData[key];
                }
                newData.push(newRow);
            });
            return newData;
        }
    };


    //对比ligerForm编辑前后的值
    //@param formID - <字符串> - ligerForm ID
    //@param fields [数组<字符串>]可选 - 只对比指定的字段
    //返回值：<Boolean> 如果对比结果一样，返回true，否者返回false
    //注：ligerForm 实例化完(onAfterSetFields)后 必须缓存数据到'CACHED_INIT_VALUES'这个属性上 ！！！
    function compareFormValues(formID, fields) {
        var _ligerForm = liger.get(formID),
            _CACHED_INIT_VALUES = _ligerForm.CACHED_INIT_VALUES,
            _CHANGED_VALUES = getFormValues(formID),
            _fields = Object.keys(_CACHED_INIT_VALUES);
        if (!fields) {
            return JSON.stringify(_CACHED_INIT_VALUES) === JSON.stringify(_CHANGED_VALUES)
        }
        // 以下是对比指定字段
        var compareResult = true;
        for (var i = 0; i < fields.length; i++) {
            var key = fields[i],
                _old = _CACHED_INIT_VALUES[key],
                _new = _CHANGED_VALUES[key];
            if (JSON.stringify(_old) != JSON.stringify(_new)) {
                compareResult = false;
                break;
            }
        }
        return compareResult;
    }

    // 获取所有表单元素的值，键值对的格式返回
    //@param fields - [数组<字符串>] - 1: 表单元素的name（id），只返回指定字段
    //@param fields - <字符串>       - 2: ligerForm ID， 返回所有字段的值
    function getFormValues(fields) {
        if (fields && typeof fields === 'string') {
            fields = liger.get(fields).autoEditors.map(function (v) {
                return v.name
            })
        }
        return _filterFields();

        function _filterFields() {
            var newValues = {};
            $(fields).each(function (index, fieldID) {
                var _editor = liger.get(fieldID),
                    _editorValue = _editor ? _editor.getValue() : $('[name=' + fieldID + ']').val();
                newValues[fieldID] = _editorValue;
            });
            return newValues;
        }
    }


    // 禁用所有表单元素
    //@param fields - [数组<字符串>] - 1: 表单元素的name（id），只返回指定字段
    //@param fields - <字符串>       - 2: ligerForm ID， 返回所有字段的值
    function setDisabledAll(fields) {
        console.log(fields)
        if (fields && typeof fields === 'string') {
            fields = liger.get(fields).autoEditors.map(function (v) {
                return v.name
            })
        }
        return _filterFields();

        function _filterFields() {
            $(fields).each(function (index, fieldID) {
                var _editor = liger.get(fieldID),
                    _$el = $('[name=' + fieldID + ']');
                if (_editor) {
                    _editor.setDisabled()
                } else if (_$el.attr('type') == 'radio') {
                    _$el.setDisabled_ligerRadio(true);
                } else if (_$el[0].tagName == 'TEXTAREA') {
                    _$el.setDisabled_ligerTextarea(true);
                }
            });
        }
    }

    function disableFiled() {
        liger.get("lnkCompNm").setDisabled(true);
        if (liger.get("bizLicNo")) {
            liger.get("bizLicNo").setDisabled(true);
        }
        if (liger.get("succ")) {
            liger.get("succ").setDisabled(true);
        }
        if (liger.get("taxRegNo")) {
            liger.get("taxRegNo").setDisabled(true);
        }
        if (liger.get("expDt")) {
            liger.get("expDt").setDisabled(true);
        }

        if (liger.get("lnkCompNm")) {
            liger.get("lnkCompNm").setDisabled(true);
        }
        if (liger.get("orgCode")) {
            liger.get("orgCode").setDisabled(true);
        }
        if (liger.get("ownerCd")) {
            liger.get("ownerCd").setDisabled(true);
        }
        if (liger.get("officeAddr")) {
            liger.get("officeAddr").setDisabled(true);
        }
        if (liger.get("majorBiz")) {
            liger.get("majorBiz").setDisabled(true);
        }
        if (liger.get("compTyp")) {
            liger.get("compTyp").setDisabled(true);
        }
        if (liger.get("bizLicNo")) {
            liger.get("bizLicNo").setDisabled(true);
        }
        if (liger.get("regAddr")) {
            liger.get("regAddr").setDisabled(true);
        }
        if (liger.get("regDt")) {
            liger.get("regDt").setDisabled(true);
        }
        if (liger.get("taxRegNo")) {
            liger.get("taxRegNo").setDisabled(true);
        }
        if (liger.get("expDt")) {
            liger.get("expDt").setDisabled(true);
        }
        if (liger.get("bizScope")) {
            liger.get("bizScope").setDisabled(true);
        }
        if (liger.get("corpRep")) {
            liger.get("corpRep").setDisabled(true);
        }
        if (liger.get("idNo")) {
            liger.get("idNo").setDisabled(true);
        }
        if (liger.get("totLnkQty")) {
            liger.get("totLnkQty").setDisabled(true);
        }
        if (liger.get("ownQty")) {
            liger.get("ownQty").setDisabled(true);
        }
        if (liger.get("ourTotLnkQyt")) {
            liger.get("ourTotLnkQyt").setDisabled(true);
        }
        if (liger.get("actCtrlNm")) {
            liger.get("actCtrlNm").setDisabled(true);
        }
        if (liger.get("actCtrlMp")) {
            liger.get("actCtrlMp").setDisabled(true);
        }
        if (liger.get("lnkNm")) {
            liger.get("lnkNm").setDisabled(true);
        }
        if (liger.get("lnkMp")) {
            liger.get("lnkMp").setDisabled(true);
        }
        if (liger.get("lnkPost")) {
            liger.get("lnkPost").setDisabled(true);
        }
        $("#rem").setDisabled_ligerTextarea(true);
        //禁用省市
        disabledRgnProvCd();
        disabledRgnCityCd();

        if (liger.get("validTmStar")) {
            liger.get("validTmStar").setDisabled(true);
        }
        if (liger.get("validTmEnd")) {
            liger.get("validTmEnd").setDisabled(true);
        }
        if (liger.get("propCd")) {
            liger.get("propCd").setDisabled(true);
        }
    }

</script>
</body>
</html>